package com.br.homebank.views;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class MainView {

	public static JFrame getView() {
		JFrame frame = new JFrame( "HomeBank Caixa II" );
		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension screenSize = kit.getScreenSize();
		frame.setSize( screenSize.width / 2, screenSize.height / 2 );
		frame.setLocationRelativeTo( null );
		frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
		frame.setJMenuBar( createMenu() );
		return frame;
	}

	private static JMenuBar createMenu() {
		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu( "Castrar" );
		JMenuItem item1 = new JMenuItem( "Cliente" );
		menu.add( item1 );
		JMenuItem item2 = new JMenuItem( "Conta" );
		menu.add( item2 );
		menuBar.add( menu );
		
		menu = new JMenu( "Listar" );
		item1 = new JMenuItem( "Clientes" );
		menu.add( item1 );
		item2 = new JMenuItem( "Contas" );
		menu.add( item2 );
		menuBar.add( menu );
		
		return menuBar;
	}
}
